﻿using System.Windows;

namespace Wp7Tools.Commands {
	public static class Events {

		public static readonly DependencyProperty MappingsProperty = DependencyProperty.RegisterAttached(
			"Mappings",
			typeof(EventsCollection),
			typeof(Events),
			new PropertyMetadata(EventsChanged));

		private static void EventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {

		}

		public static EventsCollection GetMappings(DependencyObject obj) {
		    EventsCollection eventsCollection = obj.GetValue(MappingsProperty) as EventsCollection;
            if(eventsCollection == null) {
                eventsCollection = new EventsCollection();
                SetMappings(obj, eventsCollection);
            }
		    return eventsCollection;
		}

		public static void SetMappings(DependencyObject obj, EventsCollection value) {
			obj.SetValue(MappingsProperty, value);
			value.SetDependencyObject(obj);
		}
	}
}
